import router from '@/router'
import {
  createStore
} from 'vuex'


// 创建一个新的 store 实例
const store = createStore({
  state() {
    return {
      currentPathName: ''
    }
  },
  mutations: {
    setPath(state) {
      state.currentPathName = localStorage.getItem("currentPathName")
    },
    logout() {
      //清空缓存
      localStorage.removeItem("user")
      localStorage.removeItem("menus")
      router.push("/login")
    }
  }
})
export default store